using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Main.admin
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                StatusLabel.Text = "IsPostBack = True";
            }
            else
            {
                writeUserTable();
            }
        }

        protected void writeUserTable()
        {
            String tableHTML = "";
            String startRadio = "<input type=\"radio\" id=\"user\" name=\"user\" value=\"";
            String endRadio = "\" />";
            
            DataTable dtResults = DataAccess.GetAllUsers();

            int x = 0;
            foreach (DataRow row in dtResults.Rows)
            {
                if (x == 0)
                {
                    tableHTML += "UserName | AppID | UserID | UserName | LoweredUserName | LastActivityDate | IsAnon<br />";
                }
                tableHTML += startRadio;
                tableHTML += (String)row["UserName"];
                tableHTML += endRadio;
                tableHTML += (String)row["UserName"];
                tableHTML += (Guid)row["ApplicationID"];
                tableHTML += (Guid)row["UserID"];
                tableHTML += (String)row["UserName"];
                tableHTML += (String)row["LoweredUserName"];
                // StatusLabel.Text += (String)row["MobileAlias"];
                tableHTML += (DateTime)row["LastActivityDate"];
                tableHTML += (Boolean)row["IsAnonymous"];
                tableHTML += "<br />";
                x++;

  //              String tableSample = "  <table border="1" style="width: 100%">
  //  <caption></caption>
  //  <col />
  //  <col />
  //  <col />
  //  <col />
  //  <col />
  //  <col />
  //  <tbody>
  //    <tr>
  //      <td></td>
  //      <td>Column1</td>
  //      <td>Column2</td>
  //      <td>Column3</td>
  //      <td>Column4</td>
  //      <td>Column5</td>
  //    </tr>
  //    <tr>
  //      <td><input type="radio" name="radio" /></td>
  //      <td>Row1</td>
  //      <td>Row1</td>
  //      <td>Row1</td>
  //      <td>Row1</td>
  //      <td>Row1</td>
  //    </tr>
  //    <tr>
  //      <td><input type="radio" name="radio" /></td>
  //      <td>Row2</td>
  //      <td>Row2</td>
  //      <td>Row2</td>
  //      <td>Row2</td>
  //      <td>Row2</td>
  //    </tr>
  //    <tr>
  //      <td><input type="radio" name="radio" /></td>
  //      <td>Row3</td>
  //      <td>Row3</td>
  //      <td>Row3</td>
  //      <td>Row3</td>
  //      <td>Row3</td>
  //    </tr>
  //  </tbody>
  //</table>";
            }
            TableArea.InnerHtml = tableHTML;
        }
    }
}
